package br.com.sga.controlador;

import br.com.sga.helper.Helper;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author kenzo
 */
public class ControladorAkese extends HttpServlet {
    private static final Helper helper = new Helper();

    /** 
     * Processa requisições para ambos os métodos HTTP <code>GET</code> e <code>POST</code>.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processaRequisiacao(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String destino = helper.executar(request);
        request.getRequestDispatcher(destino).forward(request, response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        processaRequisiacao(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        processaRequisiacao(request,response);
    }
}
